package com.changgou.page.service.listener;

import com.changgou.page.service.PageService;
import com.changgou.page.service.config.RabbitMQConfig;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * @ProjectName: springbootthymeleaf
 * @Package: com.changgou.page.service.listener
 * @ClassName: PageListener
 * @Author: 孙明田
 * @Description:
 * @Date: 2020/6/21 20:03
 * @Version: 1.0
 */

@Component
public class PageListener {

    @Autowired
    private PageService pageService;
    @RabbitListener(queues = RabbitMQConfig.PAGE_CREATE_QUEUE)
    public void receiveMessage(String spuId){
        System.out.println("数据更改的spuId: " + spuId);
        //调用业务成方法，创建静态页面
        pageService.generateHtml(spuId);

    }

}
